package com.mrli.configuration;

import com.mrli.openai.OpenAiService;
import com.mrli.openai.config.ChatGptConfig;
import com.mrli.openai.config.ChatGptEnableAutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

import java.util.Date;

/**
 * description
 *
 * @author LiDaShuai
 * @version 1.0
 * @project chatgpt-test
 * @date: 2023/3/4 12:53
 * @copyright 2009–2022xxxxx all rights reserved.
 */
@Configuration
@ConditionalOnMissingBean(OpenAiService.class)
public class OpenAiConfiguration {

    @Bean
    public OpenAiService openAiService(ChatGptEnableAutoConfiguration config){
        return  new OpenAiService(config.getConfig());
    }

}
